import 'package:http/http.dart' as http;

class NetUtils {
  static Future<String> get(String url, Map<String, dynamic> params) async {
    if (url != null && params != null) {
      StringBuffer sb = StringBuffer("?");
      params.forEach((key, value) {
        sb.write('$key=$value&');
      });
      String result = sb.toString().substring(0, sb.length - 1);
      url += result;
    }
    http.Response response = await http.get(url);
    return response.body;
  }

  static Future<String> post(String url, Map<String, dynamic> params) async {
    http.Response response = await http.post(url, body: params);
    return response.body;
  }
}
